package com.stockz.equity.charting.painter;

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;

import org.springframework.stereotype.Component;

import com.stockz.equity.charting.view.StockChart;
import com.stockz.equity.pattern.Painter;

@Component
public class CrosshairPainter implements Painter<StockChart> {

	@Override
	public void paint(Graphics2D g, StockChart view, Rectangle rectangle) {
		g.setClip(rectangle);
		g.setColor(view.getStockChartPanel().getStockChartPanelSkin().getCrosshairColor());
		Point point = view.getStockChartPanel().getStockChartPanelState().getCurrentPoint();
		g.drawLine(rectangle.x,point.y, rectangle.x+rectangle.width, point.y);
		g.drawLine(point.x,rectangle.y, point.x, rectangle.y+rectangle.height);
		g.setClip(null);
	}
}
